const { app, BrowserWindow, BrowserView} = require('electron')
const server = require('./app')

function createWindow () {
  // 创建浏览器窗口
  let win = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
      nodeIntegration: true
    }
  })
  let view = new BrowserView()
  win.setBrowserView(view)
  view.setBounds({ x: 0, y: 0, width: 800, height: 600 })
  view.setAutoResize({width: true, height: true, horizontal: true, vertical: true});
  view.webContents.loadURL('http://127.0.0.1:3333')

  // 加载index.html文件
  // win.loadFile('index.html')
}
app.whenReady().then(createWindow)
